package com.xinxing.learning.batch.mybatisplus.step;

import com.xinxing.learning.batch.common.LogConstants;
import com.xinxing.learning.batch.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ItemProcessor;

import java.util.Objects;

@Slf4j
public class UserItemProcessor implements ItemProcessor<User, User> {
    @Override
    public User process(User user) throws Exception {
        String title = user.getTitle();
        if (Objects.nonNull(title)) {
            user.setTitle(title.toUpperCase());
        }
        log.info(LogConstants.LOG_TAG + "beetlsql item process: " + user.getName());
        return user;
    }
}
